#include <REGX52.H>
#include <INTRINS.H>

unsigned char NixieTable[] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D, 0x7D,0x07,0x7F,0x6F};

void Delay(unsigned int ms) {
	unsigned char data i, j;
	while (ms--) {
		_nop_();
		i = 2;
		j = 199;
		do{
			while (--j);
		} while (--i);
	}
}


void Nixie(unsigned char loc, unsigned char number) {
	
	loc = ~(loc - 1);
	P2_2 = loc & 1;
	P2_3 = (loc & 2) >> 1;
	P2_4 = (loc & 4) >> 2;
	
	P0 = NixieTable[number];
	Delay(1);
	P0 = 0x00;
}

void main() {

	while (1) {
		
		Nixie(1, 1);
		Nixie(2, 2);
		Nixie(3, 3);
		Nixie(4, 4);
		
	}

}